import cherrypy

class engine_status:

   def index(self):

      yield cherrypy.root.header()

      fp = open(cherrypy.root.CONFIG["log_file"], "r")

      yield """<table id="widget" class="grid" border="0" cellpadding="0" cellspacing="1">"""
      yield """<tbody id="logs">\n"""

      count = 0

      for line in fp.readlines():

         if count % 2 == 0:
            tr_class = "even"
         else:
            tr_class = "odd"

         yield """<tr class="%s"><td>%s</td></tr>""" % (tr_class, line)

         count += 1

      yield """</tr></table>"""

      yield cherrypy.root.footer()

   index.exposed = True
